package com.chookss.tools;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

//判断是否装了虚拟定位软件
public class ForbidVirtualLocation {

    public static boolean isInstallVirtual(Context context) {
        Map<String, String> packageNames = getVirtualPackageNames();

        PackageManager packageManager = context.getPackageManager();
        List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);
        for (int i = 0; i < pinfo.size(); i++) {
            if (packageNames.get(pinfo.get(i).packageName) != null) {
                return true;
            }
        }
        return false;
    }

    private static Map<String, String> getVirtualPackageNames() {
        String[] datas = {
                "com.lerist.fakelocation",
                "com.xmstudio.locationmock",
                "top.a1024bytes.mockloc.ca.pro",
                "com.qgwapp.shadowside",
                "net.superal",
                "com.deniu.daniu",
                "com.deniu.multi",
                "com.txy.anywhere",
                "de.robv.android.xposed.installer",
                "github.tornaco.xposedmoduletest",
                "com.vphone.helper",
                "com.vphone.launcher",
                "me.haima.helpcenter",
                "me.haima.androidassist",
                "com.haimawan.push",
                "com.microvirt.market",
                "com.microvirt.memuime",
                "com.microvirt.download",
                "com.microvirt.guide",
                "com.microvirt.launcher",
                "com.tiantian.ime",
                "com.kaopu001.tiantianserver",
                "com.kop.zkop",
                "com.cyjh.ikaopu",
                "com.woshantu.modifyPosition",
                "com.sollyu.xposed.hook.model",
                "com.moconbox.dingweibao",
                "com.mobikick.dots",
                "com.lostad.fakeGPS",
                "ait.com.locationfaker",
                "com.zddingwei.gpsxunren",
                "com.evezzon.fakegps",
                "com.kanchsproject.fakegps",
                "net.anylocation.ultra",
                "com.example.yiwowang",
                "com.fakegps.mock ",
                "com.just_soft.gps",
                "com.locationholic.LocationHolic",
                "com.gps.accurategps",
                "net.anylocation",
                "com.fakeforsnapchat",
                "com.wzdsfwzzhzsq.model",
                "com.findhim",
                "com.googie",
                "com.zgt.qqzone",
                "com.cs35.noad_chatlocation",
                "cn.tinyapps.fakegps",
                "com.lexa.fakegpsdonate",
                "com.sollyu.modifymodel",
                "ua.visicom.tracker",
                "com.dh.locationmock",
                "com.wifi99.android.locationcheater",
                "com.tuokebao.multigps",
                "com.yy.xuniweizhi",
                "com.tistory.maxxgreen.app.virtuallocation",
                "com.dracrays.fakeloc",
                "com.gsxz.location",
                "com.txy.anywhere.clone",
                "com.templa.mockloc",
                "com.dingweizshou",
                "com.kollway.android.mocklocation",
                "com.tandy.android.mockwxlocation",
                "com.huichongzi.locationmocker",
                "com.mumu.launcher"};
        Map<String, String> packageNames = new HashMap<>();

        for (int i = 0; i < datas.length; i++) {
            packageNames.put(datas[i],datas[i]);
        }
//        packageNames.put("com.lerist.fakelocation", "com.lerist.fakelocation");// Fake-location虚拟定位
//        packageNames.put("com.xmstudio.locationmock", "com.xmstudio.locationmock");// 模拟定位助手
//        packageNames.put("top.a1024bytes.mockloc.ca.pro", "top.a1024bytes.mockloc.ca.pro");// 天下任我行
//        packageNames.put("com.qgwapp.shadowside", "com.qgwapp.shadowside");// 任我行免ROOT
//        packageNames.put("net.superal", "net.superal");// 超级神行者
//        packageNames.put("com.deniu.daniu", "com.deniu.daniu");// 大牛
//        packageNames.put("com.deniu.multi", "com.deniu.multi");// 大牛助手
//        packageNames.put("com.txy.anywhere", "com.txy.anywhere");// 天下游
//        packageNames.put("de.robv.android.xposed.installer", "de.robv.android.xposed.installer");// Xposed
//        packageNames.put("github.tornaco.xposedmoduletest", "github.tornaco.xposedmoduletest");// 应用管理Xposed
        return packageNames;
    }
}